using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using AutoMapper;
using ZeroSum.Domain.Dtos;
using ZeroSum.Plugin.Authorization.Datas.Aggregates.UserAggregate;
using ZeroSumZSA.Core.Aggregates.UserAggregate;

namespace ZeroSumZSA.Application.ApplicationServices.Users.Dto.In;

[AutoMap(typeof(User), ReverseMap = true)]
public class EditUserInput : UpdateInputDto<long>
{
    /// <summary>
    ///     账号
    /// </summary>
    [Required(ErrorMessage = "账号名称不能为空")]
    [DisplayName("账号")]
    [StringLength(20, MinimumLength = 3)]
    public string? Account { get; set; }

    /// <summary>
    ///     密码（默认MD5加密）
    /// </summary>
    [DisplayName("密码")]
    [Required(ErrorMessage = "密码不能为空")]
    [StringLength(50, MinimumLength = 6)]
    public string? Password { get; set; }

    /// <summary>
    ///     确认密码
    /// </summary>
    [Required(ErrorMessage = "确认密码不能为空")]
    [Compare(nameof(Password), ErrorMessage = "两次密码不一致")]
    [MaxLength(50)]
    public string? Confirm { get; set; }

    /// <summary>
    ///     昵称
    /// </summary>
    [DisplayName("昵称")]
    [StringLength(20, MinimumLength = 3)]
    public virtual string? NickName { get; set; }

    /// <summary>
    ///     姓名
    /// </summary>
    [DisplayName("姓名")]
    [MaxLength(20)]
    public virtual string? Name { get; set; }

    /// <summary>
    ///     头像
    /// </summary>
    [DisplayName("头像")]
    public virtual string? Avatar { get; set; }

    /// <summary>
    ///     生日
    /// </summary>
    [DisplayName("生日")]
    public virtual DateTime? Birthday { get; set; }

    /// <summary>
    ///     性别-男_1、女_2
    /// </summary>
    [DisplayName("性别-男_1、女_2")]
    [Required]
    public virtual Gender Sex { get; set; }

    /// <summary>
    ///     邮箱
    /// </summary>
    [MaxLength(50)]
    [Required]
    [DisplayName("电子邮箱")]
    [DataType(DataType.EmailAddress)]
    public virtual string? Email { get; set; }

    /// <summary>
    ///     手机
    /// </summary>
    [DisplayName("手机")]
    [MaxLength(20)]
    [Required]
    public virtual string? Phone { get; set; }

    /// <summary>
    ///     电话
    /// </summary>
    [DisplayName("电话")]
    [MaxLength(20)]
    public virtual string? Tel { get; set; }
}